<template>
  <div>
<center>
<h3 style="font-family: 华文行楷;">欢迎来到猪八戒网绑卡页面</h3>
请上传银行卡正面照
<el-upload
  class="upload-demo"
  action="https://upload-cn-east-2.qiniup.com"
  :data="this.data" :on-success=res>
  <img :src="this.imgurl2" width="150px" height="100px" size="small" type="primary">
</el-upload><p></p>
<div class="aaa">

<p><el-input  placeholder="银行卡类型" v-model="y_type"></el-input></p>
<p><el-input  placeholder="银行卡号" v-model="y_code"></el-input></p>

  <el-button @click="Go">点击进行绑定</el-button>

</div>


</center>
  </div>
</template>

<script>
export default {
  data(){
    return{
      s_type:"",
      data:{
        token:''
      },
      imgurl:'http://rrgkke0d9.bkt.clouddn.com/',
      imgurl2:'http://rrgkke0d9.bkt.clouddn.com/%E9%93%B6%E8%A1%8C%E5%8D%A1.png',
      y_type:'',
      y_code:'',
      userid:localStorage.getItem("userid")

    }
  },
  methods:{
    Go(){
      if(this.y_type==null || this.y_type==''){
        alert("姓名不能为空")
        return
      }
      if(this.y_code==null ||this.y_code==''){
        alert("身份证号码不能为空")
        return
      }
      this.axios.post('Y_code/',{userid:this.userid,y_type:this.y_type,y_code:this.y_code}).then((cg)=>{
        alert(cg.data.msg)
      })

    },
    getqntoken(){
      this.axios.get("imgqny/").then((cg)=>{
        this.data.token=cg.data.token
      })
    },
    res(cg){
      this.imgurl2=this.imgurl+cg.key
      this.axios.post("character/",{imgurl:this.imgurl2}).then((cg)=>{
        this.y_type=cg.data.msg
        this.y_code=cg.data.msg2
      })
    },


  },
  mounted(){
    this.getqntoken()
  }

}
</script>

<style>
.aaa{
  width: 260px;
}
</style>